package com.xxx.kjds.serviceImpl;

import com.xxx.kjds.entity.Goods;
import com.xxx.kjds.entity.OrderGoods;
import com.xxx.kjds.entity.OrderGoodsExample;
import com.xxx.kjds.entity.OrderGoodsKey;
import com.xxx.kjds.mapper.OrderGoodsMapper;
import com.xxx.kjds.service.OrderGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderGoodsServiceImpl implements OrderGoodsService {
    @Autowired
    private OrderGoodsMapper orderGoodsMapper;

    @Override
    public long countByExample(OrderGoodsExample example) {
        return orderGoodsMapper.countByExample(example);
    }

    @Override
    public int deleteByExample(OrderGoodsExample example) {
        return orderGoodsMapper.deleteByExample(example);
    }

    @Override
    public int deleteByPrimaryKey(OrderGoodsKey key) {
        return orderGoodsMapper.deleteByPrimaryKey(key);
    }

    @Override
    public int insert(OrderGoods record) {
        return orderGoodsMapper.insert(record);
    }

    @Override
    public int insertSelective(OrderGoods record) {
        return orderGoodsMapper.insertSelective(record);
    }

    @Override
    public List<OrderGoods> selectByExample(OrderGoodsExample example) {
        return orderGoodsMapper.selectByExample(example);
    }

    @Override
    public OrderGoods selectByPrimaryKey(OrderGoodsKey key) {
        return null;
    }

    @Override
    public int updateByExampleSelective(OrderGoods record, OrderGoodsExample example) {
        return orderGoodsMapper.updateByExampleSelective(record, example);
    }

    @Override
    public int updateByExample(OrderGoods record, OrderGoodsExample example) {
        return orderGoodsMapper.updateByExample(record, example);
    }

    @Override
    public int updateByPrimaryKeySelective(OrderGoods record) {
        return 0;
    }

    @Override
    public int updateByPrimaryKey(OrderGoods record) {
        return 0;
    }

    @Override
    public List<OrderGoods> selectByOid(Integer oid) {
        OrderGoodsExample OrderGoodsExample = new OrderGoodsExample();
        OrderGoodsExample.Criteria criteria = OrderGoodsExample.createCriteria();
        criteria.andOrderIdEqualTo(oid);
        return orderGoodsMapper.selectByExample(OrderGoodsExample);
    }

    public void delete(OrderGoodsKey record) {
        orderGoodsMapper.deleteByPrimaryKey(record);
    }

    public List<Goods> selectGoodByOrderID(Integer id) {
        return orderGoodsMapper.selectGoodByOrderID(id);
    }


    public OrderGoods selectByPrimaryKey(Integer goodsID, Integer orderID) {
        OrderGoodsKey OrderGoodsKey = new OrderGoodsKey(goodsID, orderID);
        return orderGoodsMapper.selectByPrimaryKey(OrderGoodsKey);
    }

    public OrderGoods select(OrderGoodsKey key) {
        return orderGoodsMapper.selectByPrimaryKey(key);
    }
}
